from symbide.src.execution.executor_sympy import Executor

#matplotlib
from symbide.src.extensions.matplotlib.additionalFunctions import matplot_toxml
#sympy
from symbide.src.extensions.sympy.additionalFunctions import \
        _Sympyplot, _EasyFunction, _defineVariables, _method_evalf
#gnuplot
from symbide.src.extensions.gnuplot.additionalFunctions import _Gnuplot
#numpy
from symbide.src.extensions.numpy.additionalFunctions import load_csv
#mathml
from symbide.src.extensions.mathml.additionalFunctions import _to_mathml

from symbide.src.execution.additionalFunctions import _show, _clear

from symbide import ModuleManager

    
import gtk

def set(Input):
    assert Input.type=='Sympy'
    Input.view.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse('#e6fec2'))
    Input.global_namespace = {}
    if ModuleManager.hasModule('sympy'):
        import sympy
        Input.global_namespace.update(vars(reload(sympy)).copy())
    sympyplot = lambda *args, **kwargs: _Sympyplot(Input, *args, **kwargs)
    Input.global_namespace.update({
                'mprint' : lambda x: _to_mathml(Input._objects, x),
                'load_csv': load_csv,
                'Plot' : sympyplot,
                'Sympyplot' : sympyplot,
                'Gnuplot': _Gnuplot,
                'clear' : lambda *args:_clear(Input.local_namespace, *args),
                'show' : lambda x:_show(Input._objects, x),
                'evalf' : _method_evalf,
                'easyFunction' : _EasyFunction,
                '__defineVariables__' : lambda *args:_defineVariables(Input, *args)
                })
    if ModuleManager.hasModule('gtksourceview'):
        Input.buffer.set_highlight(True)
    Input.executor = Executor()

        
    

        
        
    
    
    